package cn.rkylin.oms.aftersale.sysreturn.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;

import cn.rkylin.oms.aftersale.sysreturn.domain.SysReturn;
import cn.rkylin.oms.aftersale.sysreturn.domain.SysReturnSku;
import cn.rkylin.oms.warehouse.returnStockin.vo.ReturnStockinSkuVO;

/**
 * 类名:SysReturnVO <br/>
 * 作用: 退货单值类. <br/>
 * 创建原因: 退货单值类. <br/>
 * 创建时间: 2017年9月26日 下午7:03:50 <br/>
 *
 * @author zhanghao
 * @version v1.0
 */
public class SysReturnVO extends SysReturn {

    /**
     * serialVersionUID:序列号号.
     */
    private static final long serialVersionUID = 1023645692858963819L;

    private static final String STATUS_REFUNDSHOW = "<span class=\"fa fa-chevron-down\"></span>";

    // 按钮 开始
    private static final String OPERATION_BTN_EDIT = "<button onclick=\"sysReturnList.operationEdit(this)\" returnId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid='sysreturnEdit'><i class=\"fa fa-edit\"></i>&nbsp;修改</button>";
    private static final String OPERATION_BTN_EDIT_DISABLED = "<button style=\"cursor:default\" disabled returnId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='sysreturnEdit'><i class=\"fa fa-edit\"></i>&nbsp;修改</button>";
    private static final String OPERATION_BTN_DELETE = "<button onclick=\"sysReturnList.operationDelete(this)\" returnId=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\" pepid='sysreturnDelete'><i class=\"fa fa-trash-o\"></i>&nbsp;删除</button>";
    private static final String OPERATION_BTN_DELETE_DISABLED = "<button style=\"cursor:default\" disabled returnId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='sysreturnDelete'><i class=\"fa fa-trash-o\"></i>&nbsp;删除</button>";

    // private static final String OPERATION_BTN_EDIT_DISABLED = "<button
    // refundId=\"%s\" type=\"button\" class=\"btn btn-default btn-xs\"
    // disabled><i class=\"fa fa-edit\"></i>&nbsp;修改</button>";
    // private static final String OPERATION_BTN_DELETE_DISABLED = "<button
    // refundId=\"%s\" type=\"button\" class=\"btn btn-default btn-xs\"
    // disabled><i class=\"fa fa-trash-o\"></i>&nbsp;删除</button>";

    private static final String OPERATION_BTN_AUTHEN = "<button onclick=\"sysReturnList.authen(\'%s\',\'%s\')\" type=\"button\" class=\"btn btn-info btn-xs\" pepid='sysreturnAuthen'><i class=\"fa fa-check\"></i>&nbsp;审核</button>";
    private static final String OPERATION_BTN_AUTHEN_DISABLED = "<button style=\"cursor:default\" disabled type=\"button\" class=\"btn btn-disable btn-xs\" pepid='sysreturnAuthen'><i class=\"fa fa-check\"></i>&nbsp;审核</button>";
    private static final String OPERATION_BTN_CANCEL = "<button onclick=\"sysReturnList.cancel(this)\" returnId=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\" pepid='sysreturnCancel'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    private static final String OPERATION_BTN_CANCEL_DISABLED = "<button style=\"cursor:default\" disabled returnId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='sysreturnCancel'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    // 按钮 结束

    /**
     * SysReturnSku:退货单明细列表.
     */
    private List<SysReturnSku> sysReturnSkuList = new ArrayList<SysReturnSku>();

    public List<SysReturnSku> getSysReturnSku() {
        return sysReturnSkuList;
    }

    public void setSysReturnSku(List<SysReturnSku> sysReturnSkuList) {
        this.sysReturnSkuList = sysReturnSkuList;
    }

    /**
     * SysReturnSku:退货入库单明细列表.
     */
    private List<ReturnStockinSkuVO> sysFactReturnSkuList = new ArrayList<ReturnStockinSkuVO>();

    public List<ReturnStockinSkuVO> getSysFactReturnSkuList() {
        return sysFactReturnSkuList;
    }

    public void setSysFactReturnSkuList(List<ReturnStockinSkuVO> sysFactReturnSkuList) {
        this.sysFactReturnSkuList = sysFactReturnSkuList;
    }

    /**
     * searchCondition:快速查询条件.
     */
    private String quickSearch;

    public String getQuickSearch() {
        return quickSearch;
    }

    public void setQuickSearch(String quickSearch) {
        this.quickSearch = quickSearch;
    }

    /**
     * orderBy:排序规则.
     */
    private String orderBy;

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    private String operation;

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        StringBuffer opButton = new StringBuffer();
        if ("a".equals(getReturnStatus()) && !"y".equals(getIsCancel())) {
            // 待审核：可以执行审核、删除和修改
            opButton.append(String.format(OPERATION_BTN_AUTHEN, getReturnId(), getReturnCode()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_EDIT, getReturnId()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_DELETE, getReturnId()));
            opButton.append("&nbsp;");
            // opButton.append(String.format(OPERATION_BTN_CANCEL_DISABLED,
            // getReturnId()));
            // opButton.append("&nbsp;");
        } else if ("f".equals(getReturnStatus()) && !"y".equals(getIsCancel())) {
            // 待收货：可以执行取消
            // opButton.append(String.format(OPERATION_BTN_AUTHEN_DISABLED,
            // getReturnId(), getReturnCode()));
            // opButton.append("&nbsp;");
            // opButton.append(String.format(OPERATION_BTN_EDIT_DISABLED,
            // getReturnId()));
            // opButton.append("&nbsp;");
            // opButton.append(String.format(OPERATION_BTN_DELETE_DISABLED,
            // getReturnId()));
            // opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_CANCEL, getReturnId()));
            opButton.append("&nbsp;");
        }
        this.operation = opButton.toString();
    }

    /**
     * sonShow:显示详情按钮.
     */
    private String sonShow;

    public String getSonShow() {
        return STATUS_REFUNDSHOW;
    }

    public void setSonShow(String sonShow) {
        this.sonShow = sonShow;
    }

    /**
     * 系统商品复选框扩展
     */
    private String chk;

    public String getChk() {
        // return String.format(STATUS_CHK, this.getReturnId()).toString();
        return chk;
    }

    public void setChk(String chk) {
        this.chk = "";
    }

    /**
     * queryStatus:界面查询状态 待审核： 待收货： 已完成： 已取消：
     */
    private String queryStatus;

    public String getQueryStatus() {
        return queryStatus;
    }

    public void setQueryStatus(String queryStatus) {
        this.queryStatus = queryStatus;
    }

    /**
     * isOperable:是否可操作.
     */
    private String isOperable;

    public String getIsOperable() {
        // TODO：判断是否可操作
        return isOperable;
    }

    public void setIsOperable(String isOperable) {
        this.isOperable = isOperable;
    }

    // ----高级查询条件
    // begin——---------------------------------------------------------------
    /**
     * 商品商家编码
     */
    private String goodsCode;
    /**
     * 商品名称
     */
    private String goodsName;
    /**
     * 规格商家编码
     */
    private String skuCode;
    /**
     * 规格名称
     */
    private String skuName;
    /**
     * 日期类型
     */
    private String dateType;
    /**
     * 开始日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTimeInput;
    /**
     * 截止日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTimeInput;

    /**
     * paidDate:付款日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date paidDate;

    /**
     * 实际入库
     */
    private String factStockin;
    /**
     * 已填写退货信息
     */
    private String hasRerutnInfo;

    public String getGoodsCode() {
        return goodsCode;
    }

    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getSkuName() {
        return skuName;
    }

    public void setSkuName(String skuName) {
        this.skuName = skuName;
    }

    public String getDateType() {
        return dateType;
    }

    public void setDateType(String dateType) {
        this.dateType = dateType;
    }

    public Date getStartTimeInput() {
        return startTimeInput;
    }

    public void setStartTimeInput(Date startTimeInput) {
        this.startTimeInput = startTimeInput;
    }

    public Date getEndTimeInput() {
        return endTimeInput;
    }

    public void setEndTimeInput(Date endTimeInput) {
        this.endTimeInput = endTimeInput;
    }

    public Date getPaidDate() {
        return paidDate;
    }

    public void setPaidDate(Date paidDate) {
        this.paidDate = paidDate;
    }

    public String getFactStockin() {
        return factStockin;
    }

    public void setFactStockin(String factStockin) {
        this.factStockin = factStockin;
    }

    public String getHasRerutnInfo() {
        return hasRerutnInfo;
    }

    public void setHasRerutnInfo(String hasRerutnInfo) {
        this.hasRerutnInfo = hasRerutnInfo;
    }
    // ----高级查询条件
    // end--——---------------------------------------------------------------

    /**
     * 取消状态扩展
     */
    private String isCancelExt;
    /**
     * 完成状态扩展
     */
    private String finishTypeExt;

    public String getIsCancelExt() {
        return isCancelExt;
    }

    public void setIsCancelExt(String isCancelExt) {
        this.isCancelExt = isCancelExt;
    }

    public String getFinishTypeExt() {
        return finishTypeExt;
    }

    public void setFinishTypeExt(String finishTypeExt) {
        this.finishTypeExt = finishTypeExt;
    }

    /**
     * 来源单号别名扩展字段
     */
    private String orderCode;

    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    /**
     * 退货原因类型ID别名扩展字段
     */
    private String refundReasonId;

    /**
     * 退货原因类型名称别名扩展字段
     */
    private String refundReasonName;

    public String getRefundReasonId() {
        return refundReasonId;
    }

    public void setRefundReasonId(String refundReasonId) {
        this.refundReasonId = refundReasonId;
    }

    public String getRefundReasonName() {
        return refundReasonName;
    }

    public void setRefundReasonName(String refundReasonName) {
        this.refundReasonName = refundReasonName;
    }
}
